<%-- 
    Document   : sayHello.jsp
    Created on : May 5, 2012, 4:57:07 PM
    Author     : jeff
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>   
<head>
    <title>Demo of HTML5 messaging</title>
    <script type="text/javascript">
        var source = new EventSource("rest/hello/message");

        source.onmessage = function(event) {
            appendResult(event.data);
        };

        function appendResult(data) {
            var result = document.getElementById("result");
            result.innerHTML += data + "<br />";
            //alert(data);
        }
    </script>
</head>   
 
<body>   
    <h1>Getting server updates</h1>
    <div id="result"></div>  
</body>   
</html> 
